﻿Imports System.IO

Public Class Form1
    Dim Daten As XML_bearbeiten = New XML_bearbeiten
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Daten.XMLReader()

        Dim i As Integer
        For i = 0 To Daten.daten.MAX_FACH
            ComboBox1.Items.Add(Daten.daten.Fächer(i).name)
        Next
        Combox_Art.SelectedItem = "Mündlich"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim i As Integer
        Dim note_n As Noten_Class = New Noten_Class
        For i = 0 To Daten.daten.FächerAnz - 1
            If ComboBox1.SelectedItem.ToString = Daten.daten.Fächer(i).name Then
                note_n.Note(CInt(TextBox1.Text), Combox_Art.SelectedItem.ToString, TextBox_Bemerk.Text, TextBox2.Text)
                Daten.daten.Fächer(i).addNote(note_n)
                ListBox1.Items.Add(Daten.daten.Fächer(i).name + " | " + note_n.punkte.ToString + " | " + note_n.typ + " | " + note_n.datum + " | " + note_n.bemerkung)
            End If
        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Daten.XMLWriter(Daten)
        MsgBox("Noten erfolgreich übernommen!")
        Notenberechner1.loading()
        Me.Close()
    End Sub
End Class


